1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to encoding/decoding an image, and more particularly, to a method and apparatus for compression encoding/decoding an image by entropy encoding a residual value.
2. Description of the Related Art
In an image compression method such as MPEG-1, MPEG-2, MPEG-4H.264/MPEG-4 AVC (advanced video coding), an image is divided into a plurality of macro blocks for the purpose of encoding the image. When a predication block is generated by using inter prediction or intra prediction, a residual block is generated by detecting the prediction block from the original block.
The residual values of a residual block are converted to a frequency domain by a discrete cosine transformation (DCT). As a result of the conversion, discrete cosine coefficients are generated and then quantized. The quantized discrete cosine coefficients are entropy encoded by binarization and arithmetic coding schemes, and thus, image data is generated.
In the method of encoding an image in units of blocks, a loss may be generated in the image during the process of quantizing the discrete cosine coefficients. However, to improve the compression rate of an image, the image is encoded using the discrete cosine conversion and quantization schemes in spite of the loss.
According to a lossless image encoding/decoding method such as lossless JPEG, JPEG-LS, or XENA, a pixel value is directly entropy encoded without using the discrete cosine conversion and quantization schemes. Each pixel value is predicted and a prediction value is generated. The prediction value is deducted from the pixel value and thus a residual value with respect to each pixel is generated. Then, the generated residual value is entropy encoded.
Since the lossless image encoding/decoding method does not use the discrete cosine conversion and quantization schemes for compression, an image is compression encoded/decoded by using similarity and regularity in the pixel values of the image. However, when an area such as a texture area having no similarity and regularity between the pixel values is to be encoded, the size of image data after the encoding may become larger than that of image data before the encoding.